package com.frejoys.service;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.frejoys.common.dto.admin.StoreActivityQueueListDto;
import com.frejoys.common.dto.admin.StoreIdAndPageDto;
import com.frejoys.common.dto.admin.StoreIdAndStoreActivityIdDto;
import com.frejoys.common.dto.common.IdDto;
import com.frejoys.common.vo.admin.StoreActivityQueueListVo;
import com.frejoys.common.vo.store.StoreActivityQueueInfoVo;
import com.frejoys.common.vo.store.StoreActivityQueueVo;
import com.frejoys.dao.entity.StoreActivityQueue;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface StoreActivityQueueService extends IService<StoreActivityQueue> {

    default StoreActivityQueue getOnly(QueryWrapper<StoreActivityQueue> wrapper) {
        wrapper.last("limit 1");
        return this.getOne(wrapper);
    }

    default StoreActivityQueue getOnly(LambdaQueryWrapper<StoreActivityQueue> wrapper) {
        wrapper.last("limit 1");
        return this.getOne(wrapper);
    }

    // 获取等待返利的用户
    StoreActivityQueue getFirstSimpleInfo(Integer storeActivityId, Integer status);


    boolean delInfo(Integer id);

    /**
     * 获取信息
     * @param dto
     * @return
     */
    StoreActivityQueueInfoVo getInfo(IdDto dto);

    //查询用户参与店铺活动队列
    List<StoreActivityQueueVo> listInfo(StoreActivityQueueListDto dto,Long userId);


    //后台查询参与店铺活动队列
    List<StoreActivityQueueVo> adminListInfo(StoreActivityQueueListDto dto);


    //查询店铺铺活动队列
    IPage<StoreActivityQueueListVo> activityQueueListInfo(StoreIdAndStoreActivityIdDto dto);

    //根据订单编号获取活动队列信息
    StoreActivityQueue getStoreActivityQueueInfo(Long orderSn);

    //校验活动队列
    boolean verifyActivityQueue(StoreActivityQueue storeActivityQueue);

    //作废返利
    boolean finishOrderRebate(Long orderSn, Long userId);
}
